<? 
	$title="User List"; 
	$pageid="4";
	$accessid=",a10,";

	require("required/dbconnect.php"); 	
	require("required/function.php");
	require("required/header.php");
	
 	checkAccess("allow_content_management",1); 
?>
<script src="required/js/jquery-1.4.2.js"></script>
<script src="required/js/common_javascript.js"></script>
<?		
	$slideWidth=600;
	$slideHeight=300;	
	
	if($get_userinfo['user_level']!=1)
	{
		die("Invalid");
	}
				
	$get_slider=mysql_query("select * from os_slider order by order_id asc")or die(mysql_error());
	
	if(!empty($_GET['msg']))
	{
		$msg="<div class='dw_success'>Data created!</div>";
		echo "<script>displayMsg('divMsg')</script>";	
	}
	else
	{
		$msg="";
	}
?>
<table width="100%"  cellpadding="0" cellspacing="5" height="300">
<tr>
	

	<td valign="top">
		<div class="title">Slider Management</div><br>
			 <div id="divMsg"><?= $msg ?></div>
			<table width="100%" >
				
				<? if(mysql_num_rows($get_slider)==0){ ?>
				<tr valign="top">
					<td align="center" colspan="7">
					- No record found - 
					</td>
				
				<? 
					}
					else
					{
						$no=1;
						while($a=mysql_fetch_array($get_slider,MYSQL_ASSOC))
						{
							$id=$a['id'];
							
							if($a["pic"]=="")
							{
								$pic="empty";
								$piclink="noimage.jpg";
								$fix="";
							}
							else
							{
								$piclink="slider_".$a['id'].".gif";
								$width=$a['width'];
								$height=$a['height'];
								if($width>=$slideWidth or $height>=$slideHeight)
								{
									if($width-$height>0)
									{
										$fix="width=$slideWidth";
									}
									else
									{
										$fix="height=$slideHeight";
									}						
								}
								else
								{
									$fix="width=$width";
								}
							}					
							
				?>
			  <tr height="20" valign="top">
				
				<td>
				<img src="../slider/<?= $piclink ?>" <?= $fix ?>><br>
				<strong>Slide Name</strong> : <?= $a['slide_name'] ?>
				<br>
				<strong>URL</strong> : <?= $a['url'] ?>
				<br>
				
				<strong>Order ID</strong> : <?= $a['order_id'] ?><br>
				<a href="slider_edit.php?id=<?= $id ?>"> <img src="images/icons/edit.gif" border="0"></a>
                 <a href="slider_delete.php?id=<?= $id ?>"> <img src="images/icons/delete.gif" border="0"></a>
				<br><br>
				<hr>
				<br><br>
				</td>								
			  </tr>
				<? 
					$no++; 
						}
					}
				?>
				
			</table>
			
		<table>
			<tr>
				<td colspan="3"><input type="button" value="Add New Slide" class="button" onClick="window.open('slider_add.php','_self')"></td>
			</tr>
		</table>
		
		
		</td>
	</tr>
	
	
</table>
<? require("required/footer.php"); ?>

